/**
 * 函数集合 
 * 以来JQUERY 
 */

/**
 * 脚步按钮点击
 */
;
(function() {
    $('body').on('click', '.openurl', function() {
        var that = $(this);
        that.addClass('active-warning')
        $('.iconfont', that).addClass('iconfont-active')
        var url = that.data('url');
        if (that.data('id') != '' && typeof (that.data('id')) != 'undefined') {
            url += '&id=' + that.data('id');
        }
        window.location.href = Index + url;
    })
})();


/**
 * 返回代码
 */
function goback() {
    history.go(-1);
}

/**
 * layer
 * 提示代码
 */
function msg(info) {
    layer.msg(info, {
        time: 1000
    });
}

/**
 * post
 */
function post(url, data, callback) {
    var index = layer.load();
    $.post(url, data, function(res) {
        if (typeof callback == 'function') {
            layer.close(index);
            callback(res);
        }
    }, 'json');

}

//添加进购物车 
function add_to_cart(that) {
    var id = $(that).data('id');
    if (id == null || undefined == id) {
        msg('您未选择商品');
        return;
    }

    post(API + 'add_to_cart', {
        id: id
    }, function(data) {

    });
}


/**
 * 地理位置选择
 */

